package com.yanqu.road.logic.activity.foxcard.game.sorcery;

import com.yanqu.road.entity.activity.foxcard.FoxSaleCard;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardCouponType;

import java.util.List;

/**
 * 随机生成{1}张{0}品质的小丑牌。（需要有空位）
 */
public class FoxCardSorceryUse5 extends FoxCardSorceryUseBase{
    @Override
    protected boolean sorceryUse(FoxCardGameLogic gameLogic) {
        int quality = sorceryConfig.getParamList().get(0);
        int num = sorceryConfig.getParamList().get(1);

        int checkNum = gameLogic.getGameData().getEffectCards().size() + num;
        if (checkNum > gameLogic.getGameData().getEffectCardNumLimit()) {
            return true;//能用但是不获得卡
        }

        List<FoxSaleCard> foxSaleCards = gameLogic.getConfig().randomEffectCard(gameLogic.getGameData().getEffectCards(), quality, num, -1,gameLogic.getCouponAddValue(eFoxCardCouponType.COUPON8.getValue()));
        if (foxSaleCards.isEmpty()) {
            return false;
        }

        for (FoxSaleCard foxSaleCard : foxSaleCards) {
            gameLogic.addNewEffectCard(foxSaleCard.getConfigId(), foxSaleCard.getVersionEffect());
        }
        return true;
    }
}
